@extends('admin.base')
    @section('content')
        <!-- Content Header (Page header) -->
        <section class="content-header">

          <h1>
            &nbsp;&nbsp;&nbsp;&nbsp;评论查看
            <small>goods comments watch</small>
          </h1>
          <div class='col-md-3'>
            <form action="{{url('admin/comment/create')}}" method="get" class="sidebar-form">
            <div class="input-group">
              <input type="text" name="name" class="form-control" placeholder="输入书名"/>
              <span class="input-group-btn">
                <button type='submit' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
              </span>
            </div>
          </form>
          </div>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">评论信息</a></li>
            <li class="active">列表</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-md-12">
              <div class="box">
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-th"></i> 评论管理</h3>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table class="table table-bordered">
                    <tr>
                      <th style="width:60px">id</th>
                      <th>评论人</th>
                      <th>被评论的商品</th>
                      <th>评论的内容</th>
                      <th>
                        评论的时间
                        <a href="{{url('admin/comment/timeUp')}}"><button class="btn btn-xs btn-info"> ↑ </button></a>
                        <a href="{{url('admin/comment/timeDown')}}"><button class="btn btn-xs btn-danger"> ↓ </button></a>
                      </th>
                      <th>
                        评论是否审核
                        <a href="{{url('admin/comment/checkYes')}}"><button class="btn btn-xs btn-success"> √ </button></a>
                        <a href="{{url('admin/comment/checkNo')}}"><button class="btn btn-xs btn-danger"> X </button></a>
                      </th>
                      <th>
                        评论等级
                         <a href="{{url('admin/comment/levelUp')}}"><button class="btn btn-xs btn-info"> ↑ </button></a>
                         <a href="{{url('admin/comment/levelDown')}}"><button class="btn btn-xs btn-danger"> ↓ </button></a>
                      </th>
                      <th style="width: 100px">操作</th>
                    </tr>
                     @foreach ($list as $v)
                    <tr> 
                      <td>{{$v->id}}</td>
                      <td>{{$v->uid}}</td>
                      <td>{{$v->bid}}</td>
                      <td>{{$v->content}}</td>
                      <td>{{date("Y-m-d H:i:s",$v->time)}}</td>
                      <td>
                        @if($v->check==1)
                          <button class="btn btn-xs btn-success">已通过审核</button> | <a href="{{url('admin/comment/')}}/{{$v->id}}/edit?status=forbidme"><button class="btn btn-xs btn-danger">不让通过</button></a>
                        @else
                          <button class="btn btn-xs btn-warning">未通过审核</button> | <a href="{{url('admin/comment/')}}/{{$v->id}}/edit?status=iwantpas"><button class="btn btn-xs btn-primary">令其通过</button></a>
                        @endif
                      </td>
                      <td>
                        <button class="btn btn-xs btn-warning">
                        <!-- <span style='color:yellow'> -->
                        @for($i=0;$i<$v->level;$i++)
                          ★
                        @endfor
                        <!-- </span> -->
                        </button>
                      </td>
                      <td>
                      <button onclick="doDel({{$v->id}})" class="btn btn-xs btn-danger">删除</button> 
                      
                      <!-- <a href="{{url('admin/comment')}}/{{$v->id}}/edit"><button class="btn btn-xs btn-primary" >编辑</button></a></td> -->
                    </tr>
                  @endforeach
                 
                  </table>
                </div><!-- /.box-body -->
                <div class="box-footer clearfix">
                   
                      {!! $list->appends(["name"=>$list->name])->render() !!}
                   
                </div>
              </div><!-- /.box -->

              
              
            </div><!-- /.col -->
            
          </div><!-- /.row -->
         
        </section><!-- /.content -->
        <form action="" style="display:none;" id="mydeleteform" method="post">
            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
            <input type="hidden" name="_method" value="DELETE">
        </form>
    @endsection
    
    
    @section("myscript")
      <script type="text/javascript">
            function doDel(id){
                if(confirm('确定要删除吗？')){
                    $("#mydeleteform").attr("action","{{url('admin/comment/')}}/"+id).submit(); 
                }
            }
      </script>
    @endsection